<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #box{width:100px;height:100px;border:1px solid #000;}
    </style>
</head>
<body>
    
    <button onclick="ml()">变长</button>
    <div id="box" style="color:#f00"></div>

    <script>
        function ml()
        {
            var box = document.getElementById("box");
            console.log(box);
            //console.dir(box);
            
            box.style.backgroundColor = '#f90';
            box.style.width = "50px";
            box.style.height = "1000px";
            console.log(box);
            console.log(box.style.color);
            //仅仅能获取 行内的样式
        }
    </script>
</body>
</html>